1. Field of the Invention
The present invention relates to a motion vector decision apparatus and a motion vector decision method in a moving image encoding apparatus and a recording medium.
2. Description of the Related Art
A digital video camera is well known as a moving image recoding apparatus with an integrated camera, which captures an object image and compress-codes and records moving image data obtained by the image capturing. Recording media that record moving image data have recently shifted from conventional magnetic tapes to disk media and semiconductor memories which are convenient because of, for example, their random accessibility. As a compression method, MPEG-2 is generally used because it allows compression at a high compression ratio using inter-frame motion prediction. In recent years, H.264 that enables compression at a higher compression ratio or the like is also used.
An encoding apparatus using such a compression method searches for a motion vector between frames for each macroblock that is the unit of encoding obtained by dividing a frame image, and performs motion compensation to decrease the information amount.
The information amount of an image signal is decreased by the motion compensation. In moving image encoding, however, motion information also needs to be encoded. Hence, when searching for a motion vector, it is necessary to consider not only image similarity (distortion amount) but also the code amount of a motion vector and the like. Typically, an encoding cost C to be used to decide a motion vector is obtained using an evaluation function given byC=D+λR  (1)where D is the encoding distortion, R is the generated code amount, and λ is a coefficient, and a motion vector is searched for based on the encoding cost. As the encoding distortion D, the difference amount between the original image and the predicted image and, more particularly, the sum of squares of differences, the sum of absolute differences, or the like is used. As the generated code amount R and the coefficient λ, the code amount of a motion vector and a quantization step are generally used, respectively.
In the above-described compression method, the generated code amount R of a motion vector is calculated based on the difference amount from an estimated motion vector obtained from neighboring motion vectors. When searching for a motion vector, the neighboring motion vectors are not always correctly obtained, and the generated code amount R may not be correctly evaluated. Japanese Patent Laid-Open No. 2008-154072 describes a method of coping with this.